﻿using System.Windows;
using System.Windows.Controls;
using LiveTiss.Schemas;

namespace LiveTiss.Guias.UserControls
{
    public partial class Endereco : UserControl
    {
        #region Value

        public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value",
            typeof(ct_endereco), typeof(Endereco), new PropertyMetadata(null));

        public ct_endereco Value
        {
            get { return (ct_endereco)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }

        private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //Endereco myControl = d as Endereco;

            //if (myControl != null)
            //{
            //    if (e.NewValue != null)
            //    {
            //        ct_endereco endereco = (ct_endereco)e.NewValue;

            //        myControl.content.Content = endereco;
            //    }
            //}
        }

        #endregion

        public Endereco()
        {
            InitializeComponent();

            if (this.Value == null)
            {
                this.Value = new ct_endereco()
                {
                    cep = string.Empty,
                    codigoIBGEMunicipio = string.Empty,
                    codigoUF = st_UF.AC,
                    complemento = string.Empty,
                    logradouro = string.Empty,
                    municipio = string.Empty,
                    numero = string.Empty,
                    tipoLogradouro = st_tipoLogradouro.Item001
                };
            }
        }
    }
}
